""" DigitalICS: mobile data collection tool to complete surveys with integrated multimedia

    Copyright (C) 2009. Yael Schwartzman  

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
    
    Contact information: Yael Schwartzman -  yaelsf@gmail.com
    """
from api.form import Form
from api.constants import Constants
from forms.enform1 import enform1
from forms.enform2 import enform2
from forms.enform3 import enform3
from forms.enform4 import enform4
from forms.enform5 import enform5

def en_master(community = None,locality=None, municipality = None, producer = None):
    """ Sample master form"""
    # Step 1: create a new form
    c = Constants()
    form = Form()
    
    #Define the variables of the data that will be collected
    form.add_mult_data(["Organization","Producer","Municipality","Locality",
                      "Inspector", "enform1","enform2","enform3", "enform4", "enform5",
                        "ts1","ts2"])
    
    #get producer and community ID from caller
    form.set_producer_id(producer)
    form.set_community_id(community)
    form.set_localidad_id(municipality)
    form.set_municipio_id(locality)
    form.set_module("en_master")
    form.set_id("DigitalICS")
    form.set_name("Main Form")

   
    #The prompts are added in the order they were received
    form.add_prompt(id =   "organization",
                           default = form.community, 
                           data =  "Organization",
                           label = "Organization Code",
                           audio = "organization",
                           input_type= c.INPUT,
                           return_type= c.RETURN_INTEGER)
    
    

    
    form.add_prompt(id =   "municipality",
                           default = form.community, 
                           data =  "Municipality",
                           label = "Municipality Code",
                           audio = "municipio",
                           input_type= c.INPUT,
                           return_type= c.RETURN_INTEGER)
    
    form.add_prompt(id =   "locality",
                           default = form.community, 
                           data =  "Locality",
                           label = "Locality Code",
                           audio = "localidad",
                           input_type= c.INPUT,
                           return_type= c.RETURN_INTEGER)
        
    form.add_prompt(id = "producer",
                          data = "Producer",
                          label = "Producer Code",
                          audio = "producer",
                          input_type= c.INPUT,
                          return_type= c.RETURN_INTEGER)
    
    form.add_prompt(id = "Section1",
                   input_type = c.FORM,
                   data= "enform1",
                   module = enform1,
                   label = "Completar seccion 1" )
    
    
    form.add_prompt(id = "Section2",
                   input_type = c.FORM,
                   data= "enform2",
                   module = enform2,
                   label = "Completar seccion 2" )
    
    form.add_prompt(id = "Section3",
                   input_type = c.FORM,
                   data= "enform3",
                   module = enform3,
                   label = "Completar seccion 3" )
    
    form.add_prompt(id = "Section4",
                   input_type = c.FORM,
                   data= "enform4",
                   module = enform4,
                   label = "Completar seccion 4" )
    
    form.add_prompt(id = "Section5",
                   input_type = c.FORM,
                   data= "enform5",
                   module = enform5,
                   label = "Completar seccion 5" )
    
    return form
